using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace UWBGL_XNA_Lib13
{
	public class UWB_XFormInfo
	{
		Vector3 mTranslation;
		Vector3 mScale;
		float mRotation; //in radians
		Vector3 mPivot;

		public UWB_XFormInfo()
		{
			mPivot = Vector3.Zero;
			toIdentity();
		}

		public void setupModelStack(UWB_DrawHelper drawHelper)
		{
			drawHelper.accumulateModelTransform(mTranslation, mScale, mRotation, mPivot);
		}

		public void setupModelStack_CENTERED(UWB_DrawHelper drawHelper, Vector3 correction)
		{
			drawHelper.accumulateModelTransform(mTranslation + correction, mScale, mRotation, mPivot);
		}

		public void toIdentity()
		{
			mTranslation = Vector3.Zero;
			mScale = Vector3.One;
			mRotation = 0;
		}

		public Vector3 getTranslation()
		{
			return mTranslation;
		}

		public void setTranslation(Vector3 translation)
		{
			mTranslation = translation;
		}

		public Vector3 getScale()
		{
			return mScale;
		}

		public void setScale(Vector3 scale)
		{
			mScale = scale;
		}

		public float getRotationInRadians()
		{
			return mRotation;
		}

		public float getRotationInDegrees()
		{
			return MathHelper.ToDegrees(mRotation); 
		}

		public void setRotationRadians(float radians)
		{
			mRotation = radians;
		}

		public void setRotationDegrees(float degrees)
		{
			mRotation = MathHelper.ToRadians(degrees);
		}

		public Vector3 getPivot()
		{
			return mPivot;
		}

		public void setPivot(Vector3 pivot)
		{
			mPivot = pivot;
		}

		public void drawPivot(UWB_DrawHelper drawHelper, float size)
		{
			drawHelper.resetAttributes();
			drawHelper.setColor1(new Color(new Vector3(1f, 1f, 1f)));
			drawHelper.setColor2(new Color(new Vector3(0, 0, 1f)));
			drawHelper.setFillMode(eFillMode.fmSolid);
			drawHelper.setShadeMode(eShadeMode.smGouraud);
			drawHelper.drawCircle(mPivot, size);
		}
	}
}
